<template>
	<div class="tab-nav">
		<!--文本-->
		<div v-if="showData.type === '2'" class="nav-list"
			:style="{ color: showData.fontColor, backgroundColor: showData.bgColor }">
			<div v-for="(item, index) in showData.navList" :key="index" class="nav-item-item text-overFlow-1">
				<span :style="{ color: showData.fontColor }">{{ item.title }}</span>
			</div>
		</div>
		<!--图片-->
		<div v-else class="nav-item-image" :style="{ color: showData.fontColor, backgroundColor: showData.bgColor }">
			<div v-for="(item, index) in showData.navList" :key="index" class="nav-item-image-li"
				:class="{ 'is-nav-cell4': showData.showNum === 4, 'is-nav-cell5': showData.showNum === 5 }">
				<div style="text-align: center">
					<img :src="item.url" />
					<p class="text-overFlow-1" :style="{ color: showData.fontColor }">
						<span v-if="item.title">{{ item.title }}</span>
					</p>
				</div>
			</div>
		</div>
	</div>
</template>

<script lang="ts">
import { defineComponent } from 'vue';

export default defineComponent({
	props: {
		showData: {
			type: Object as any,
			defult: {},
		},
	},
	setup() {
		return {};
	},
});
</script>

<style scoped lang="scss">
.tab-nav {
	.text-overFlow-1 {
		overflow: hidden;
		text-overflow: ellipsis;
		-o-text-overflow: ellipsis;
		-webkit-text-overflow: ellipsis;
		-moz-text-overflow: ellipsis;
		white-space: nowrap;
	}

	.nav-list {
		display: flex;
		padding-bottom: 10px;

		.nav-item-item {
			position: relative;
			flex: 1;
			vertical-align: top;
			height: 45px;
			line-height: 45px;
			text-align: center;
			color: #666666;
		}
	}

	.nav-item-image {
		padding: 8px 15px 5px 16px;

		.nav-item-image-li {
			display: inline-block;
			vertical-align: bottom;
			margin-top: 2px;

			&.is-nav-cell4 {
				width: 25%;
			}

			&.is-nav-cell5 {
				width: 20%;
			}

			img {
				transition: all 0.28s;
				width: 40px;
				height: 40px;
				// object-fit: cover;
				// object-position: center;
			}

			p {
				// width: 70px;
				color: #fff;
				font-size: 12px;
				text-align: center;
			}
		}
	}
}
</style>
